package com.example.departmentService.controller;


import com.example.departmentService.entity.ResumeBlock;
import com.example.departmentService.entity.dto.ResumeConditons;
import com.example.departmentService.service.IResumeBlockService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@Api(value = "/resumeblock", tags = "简历池")
@RestController
@RequestMapping("/resumeblock")
public class ResumeBlockController {
    @Autowired
    private IResumeBlockService resumeBlockService;

    @ApiOperation(value = "添加简历", notes = "添加简历")
    @PostMapping("/insert")
    @CrossOrigin(origins = "*")
    public Integer insert(@RequestBody ResumeBlock resumeBlock) {
        return resumeBlockService.insert(resumeBlock);
    }

    @ApiOperation(value = "查询所有简历", notes = "查询所有简历")
    @PostMapping("/findAll")
    @CrossOrigin(origins = "*")
    public List<ResumeBlock> findAll() {
        List<ResumeBlock>  resumeBlocks = resumeBlockService.findAll();
        return resumeBlocks;
    }

    @ApiOperation(value = "根据性别学历查询", notes = "根据性别学历查询")
    @PostMapping("/selectList")
    @CrossOrigin(origins = "*")
    public List<ResumeBlock> selectList(ResumeConditons resumeConditons) {
        List<ResumeBlock>  resumeBlocks = resumeBlockService.selectList(resumeConditons);
        System.out.println(resumeConditons.getPersonGender()+"--性别--");
        System.out.println(resumeConditons.getPersonEducation()+ "---学历---");
        System.out.println(resumeBlocks);
        return resumeBlocks;
    }
}
